#include "my_stdio.h"
#include <stdio.h>
#include <unistd.h>
#include <string.h>

int main(){
    mFILE* fp = mfopen("./log.txt", "w");
    if(fp == NULL){
        perror("file open error!\n");
        return 1;
    }
    int cnt = 10;
    while(cnt > 0){
        char buffer[64];
        snprintf(buffer, sizeof(buffer), "hello message %d", cnt);
        mfwrite(buffer, strlen(buffer), fp);
        cnt--;
        mfflush(fp);
        sleep(2);
    }
    mfclose(fp);
    return 0;
}
